/******************************************************************************
 *      Mestrado em Ciência da Computação - UFMS
 *		Redes de Computadores - Prof. Dr. Ronaldo Alves Ferreira
 *		Alunos: Geraldo Landre, Marcel Tolentino, Vinícius Bueno
 *****************************************************************************/
#ifndef VSTRING_H
#define VSTRING_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

typedef struct
{
    char *pt;
    unsigned length;
    unsigned mem_size;
}vstring;

#define COMMA                   ","
#define COLON                   ":"
#define SEMICOLON               ";"
#define SPACE                   " "
#define COMMENT                 "#"
#define DASH                    "-"
#define SLASH                   "/"
#define EQUAL                   "="
#define ASTERISK                "*"
#define QUESTION                "?"
#define AMPERSAND               "&"
#define END_STRING              "\0"
#define TAB                     "\t"
#define CR                      "\r"
#define END_LINE                "\n"
#define END_HEADER_LINE         "\r\n"
#define END_HEADER              "\r\n\r\n"


vstring* new_vstring();

int realloc_string(vstring **v,int size);

int alloc_string(vstring **v,int size);

int free_string(vstring **v);

int is_null(vstring **v);

void print_string(vstring *v);

void print_vstring(vstring *v);

int get_more_space(vstring **v,unsigned new_size);

int copy_string(vstring **v,char *orig);

int copy_vstring(vstring **copy,vstring *orig);

int copy_substring(vstring **copy,vstring *orig,int start,int size);

int concat_string(vstring **pre,char *suf);

int concat_vstring(vstring **pre,vstring *suf);

int get_index_occour(vstring *v,char *occour);

void remove_substring(vstring **v,int start,int size);

void insert_substring(vstring **v,int start,int size);

void trim(vstring **v);

int get_token(vstring **orig,vstring **tk,char *delimiter);

int remove_occour(vstring **v,char *occour);

int remove_all(vstring **v,char *occour);

int replace_occour(vstring **v,char *old_occ,char *new_occ);

int replace_all(vstring **v,char *old_occ,char *new_occ);

#endif